<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>任务管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
	<style>
		 #bc-close td  {
			color: #3fa43f;
		}
		 #bc-open td  {
			color: #ff0100;
		}
		 #bc-processing td  {
			color: #042aa1;
		}
	</style>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/devmng/taskMain/">任务列表</a></li>
		<shiro:hasPermission name="devmng:taskMain:edit"><li><a href="${ctx}/devmng/taskMain/generate">任务添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="taskMain" action="${ctx}/devmng/taskMain/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>任务名称：</label><form:input path="taskTitle" htmlEscape="false" maxlength="50" class="input-medium"/></li>
			<li><label>计划开始：</label>
				<input name="beginTaskStart" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
					value="<fmt:formatDate value="${taskMain.beginTaskStart}" pattern="yyyy-MM-dd HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/> - 
				<input name="endTaskStart" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
					value="<fmt:formatDate value="${taskMain.endTaskStart}" pattern="yyyy-MM-dd HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
			</li>
			<li><label>计划结束：</label>
				<input name="beginTaskEnd" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
					value="<fmt:formatDate value="${taskMain.beginTaskEnd}" pattern="yyyy-MM-dd HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/> - 
				<input name="endTaskEnd" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
					value="<fmt:formatDate value="${taskMain.endTaskEnd}" pattern="yyyy-MM-dd HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
			</li>
			<li><label>操作人：</label>
				<sys:treeselect id="taskOperator" name="taskOperator.id" value="${taskMain.taskOperator.id}" labelName="taskOperator.name" labelValue="${taskMain.taskOperator.name}"
					title="用户" url="/sys/office/treeData?type=3" cssClass="input-small" allowClear="true" notAllowSelectParent="true"/>
			</li>
			<li><label>任务类型：</label>
				<form:select path="taskType" class="input-medium">
					<form:option value="" label=""/>
					<form:options items="${fns:getDictList('DEVCHK_PERIOD')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</li>
			<li><label>部门：</label>
				<sys:treeselect id="sysOffice" name="sysOffice.id" value="${taskMain.sysOffice.id}" labelName="sysOffice.name" labelValue="${taskMain.sysOffice.name}"
					title="部门" url="/sys/office/treeData?type=2" cssClass="input-small" allowClear="true" notAllowSelectParent="true"/>
			</li>
			<li><label>任务状态：</label>
				<form:select path="taskStatus" class="input-medium">
					<form:option value="" label=""/>
					<form:options items="${fns:getDictList('TASK_MAIN_STATUS')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>任务标题</th>
				<th>任务执行人</th>
				<th>任务类型</th>
				<th>任务状态</th>
				<th>开始时间</th>
				<th>完成时间</th>

				<th>计划开始时间</th>
				<th>计划完成时间</th>
				<th>最新操作时间</th>
				<th>备注</th>
				<th>部门</th>
				<shiro:hasPermission name="devmng:taskMain:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="taskMain">
			<c:if test="${taskMain.taskStatus == 'CLOSE'}">
				<c:set var="color"  value="id = bc-close"/>
			</c:if>
			<c:if test="${taskMain.taskStatus == 'OPEN'}">
				<c:set var="color"  value="id = bc-open"/>
			</c:if>
			<c:if test="${taskMain.taskStatus == 'PROCESSING'}">
				<c:set var="color"  value="id = bc-processing"/>
			</c:if>
			<tr <c:out value="${color}"/>>
				<td>
						${taskMain.taskTitle}
				</td>
				<td>
						${taskMain.taskOperator.name}
				</td>
				<td>
						${ fns:getDictLabel (taskMain.taskType, 'DEVCHK_PERIOD', '')}
				</td>
				<td>
						${ fns:getDictLabel (taskMain.taskStatus, 'TASK_MAIN_STATUS', '')}
				</td>
				<td>
					<fmt:formatDate value="${taskMain.startDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					<fmt:formatDate value="${taskMain.closeDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					<fmt:formatDate value="${taskMain.taskStart}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					<fmt:formatDate value="${taskMain.taskEnd}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					<fmt:formatDate value="${taskMain.updateDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					${taskMain.remarks}
				</td>
				<td>
					${taskMain.sysOffice.name}
				</td>
				<shiro:hasPermission name="devmng:taskMain:edit"><td>
					<a href="${ctx}/devmng/taskMain/detail?id=${taskMain.id}">详情</a>
    				<%--<a href="${ctx}/devmng/taskMain/generate?id=${taskMain.id}">修改</a>
    				<a href="${ctx}/devmng/taskMain/taskMainExecDetailListSingle?id=${taskMain.id}" target="_blank">情况</a>--%>
					<%--<a href="${ctx}/devmng/taskMain/delete?id=${taskMain.id}" onclick="return confirmx('确认要删除该任务吗？', this.href)">删除</a>--%>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>